home *** CD-ROM | disk | FTP | other *** search
- /* $Id: ckmxla.c,v 1.6 91/12/15 23:18:06 rick Exp $
- * $Source: /uw/mackermit/RCS/ckmxla.c,v $
- *------------------------------------------------------------------
- * $Log: ckmxla.c,v $
- * Revision 1.6 91/12/15 23:18:06 rick
- * ut9
- *
- * Revision 1.5 91/10/22 11:56:16 rick
- * Fixup includes.
- *
- * Revision 1.4 91/10/21 21:43:58 fdc
- * Make sure all sources lines are < 80.
- * Update with a year's worth of changes from Unix version,
- * but use only three character sets. Fix the tables, functions,
- * and tables of functions. And the comments. Etc etc.
- *
- * Revision 1.3 91/10/03 12:43:03 rick
- * UT(5)
- *
- *------------------------------------------------------------------
- * $Endlog$
- */
- char *xlav = "Macintosh Character Set Translation 5A(012), 2 Feb 93";
-
- /* C K M X L A */
-
- /* C-Kermit tables and functions supporting character set translation. */
- /* Macintosh-only version */
- /*
- Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
- Columbia University Center for Computing Activities.
- Copyright (C) 1985, 1992, Trustees of Columbia University in the City of New
- York. Permission is granted to any individual or institution to use this
- software as long as it is not sold for profit. This copyright notice must be
- retained. This software may not be included in commercial products without
- written permission of Columbia University.
- */
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #include "ckcdeb.h" /* Includes... */
- #include "ckcker.h"
- #include "ckucmd.h" /* Needed for struct keytab */
- #include "ckmdef.h"
- #include "ckmptp.h" /* ckm* Prototypes */
- #include "ckcxla.h"
- #include "ckmxla.h"
-
- /* Character set translation data and functions */
-
- extern int zincnt;
- extern char *zinptr;
- extern int zoutcnt;
- extern char *zoutptr;
-
- int tslevel = TS_L0; /* Transfer syntax level (0,1,2) */
- int tcharset = TC_TRANSP; /* Transfer syntax character set */
- int fcharset = FC_APPQD; /* Local file character set */
- int tcsr = FC_USASCII; /* Remote terminal character set */
- int tcsl = FC_APPQD; /* Local terminal character set */
- int language = L_USASCII; /* Language */
-
- /* This list is indexed by the transfer character set number. */
- struct csinfo tcsinfo[] = { /* Transfer character-set info */
- /* Name size code designator alphabet */
- "Transparent", 256, TC_TRANSP, "", AL_UNK, "transparent",
- "US ASCII 7-bit", 128, TC_USASCII, "", AL_ROMAN, "ascii",
- "Latin-1 ISO 8859-1", 256, TC_1LATIN, "I6/100", AL_ROMAN, "latin1"
- };
- int ntcsets = (sizeof(tcsinfo) / sizeof(struct csinfo));
-
- struct keytab tcstab[] = { /* Keyword table for */
- "ascii", TC_USASCII, 0, /* SET TRANSFER CHARACTER-SET */
- "latin1-iso", TC_1LATIN, 0,
- "transparent", TC_TRANSP, 0
- };
- int ntcs = (sizeof(tcstab) / sizeof(struct keytab));
-
- /* Grrr... Had to back off on moving this to ckmxla.h because that file */
- /* is included by more than one module, so link complains about multiple */
- /* definitions of _fcsinfo, _fcstab, etc. */
-
- /* File character set information structure, indexed by character set code, */
- /* as defined in ckmxla.h. This table must be in order of file character */
- /* set number! */
-
- struct csinfo fcsinfo[] = { /* File character set information... */
- /* Descriptive Name Size Designator */
- "US ASCII", 128, FC_USASCII, NULL, AL_ROMAN, "ascii",
- "ISO Latin-1", 256, FC_1LATIN, NULL, AL_ROMAN, "latin1",
- "Macintosh Latin", 256, FC_APPQD, NULL, AL_ROMAN, "macintosh-latin"
- };
-
- /* Local file character sets */
-
- struct keytab fcstab[] = { /* Keyword table for 'set file character-set' */
-
- /* Keyword Value Flags */
- "apple-quickdraw", FC_APPQD, CM_INV, /* Macintosh Quickraw */
- "ascii", FC_USASCII, 0, /* ASCII */
- "latin-1", FC_1LATIN, 0, /* ISO Latin Alphabet 1 */
- "macintosh-latin", FC_APPQD, 0, /* "Extended Mac Latin" */
-
- };
- int nfilc = (sizeof(fcstab) / sizeof(struct keytab)); /* size of this table */
-
- /*
- Languages:
-
- This table serves two purposes. First, it allows C-Kermit to have a
- SET LANGUAGE command, which automatically selects the associated file
- character set and transfer character set. Second, it allows the program
- to apply special language-specific rules when translating from a character
- set that contains national characters into plain ASCII, like German umlaut-a
- becomes ae.
- */
-
- struct langinfo langs[] = {
- /* Language code File Charset Xfer Charset Name */
- L_USASCII, FC_USASCII, TC_USASCII, "ASCII (American English)",
- L_DANISH, FC_APPQD, TC_1LATIN, "Danish",
- L_DUTCH, FC_APPQD, TC_1LATIN, "Dutch",
- L_FINNISH, FC_APPQD, TC_1LATIN, "Finnish",
- L_FRENCH, FC_APPQD, TC_1LATIN, "French",
- L_GERMAN, FC_APPQD, TC_1LATIN, "German",
- L_HUNGARIAN, FC_APPQD, TC_1LATIN, "Hungarian",
- L_ITALIAN, FC_APPQD, TC_1LATIN, "Italian",
- L_NORWEGIAN, FC_APPQD, TC_1LATIN, "Norwegian",
- L_PORTUGUESE, FC_APPQD, TC_1LATIN, "Portuguese",
- L_SPANISH, FC_APPQD, TC_1LATIN, "Spanish",
- L_SWEDISH, FC_APPQD, TC_1LATIN, "Swedish",
- L_SWISS, FC_APPQD, TC_1LATIN, "Swiss"
- };
- int nlangs = (sizeof(langs) / sizeof(struct langinfo));
-
- /*
- Keyword table for the SET LANGUAGE command.
- Only a few of these (German, Scandinavian, etc) actually do anything.
- The language is used to invoke special translation rules when converting
- from an 8-bit character set to ASCII; for example, German u-diaeresis
- becomes "ue", Dutch y-diaeresis becomes "ij". Languages without associated
- rules are invisible (CM_INV).
- */
- struct keytab lngtab[] = {
- "ascii", L_USASCII, CM_INV,
- "danish", L_DANISH, 0,
- "dutch", L_DUTCH, 0,
- "english", L_USASCII, CM_INV,
- "finnish", L_FINNISH, 0,
- "french", L_FRENCH, CM_INV,
- "german", L_GERMAN, 0,
- "hungarian", L_HUNGARIAN, CM_INV,
- "icelandic", L_ICELANDIC, 0,
- "italian", L_ITALIAN, CM_INV,
- #ifdef KANJI
- "japanese", L_JAPANESE, CM_INV,
- #endif /* KANJI */
- "norwegian", L_NORWEGIAN, 0,
- "none", L_USASCII, 0,
- "portuguese", L_PORTUGUESE, CM_INV,
- #ifdef CYRILLIC
- "russian", L_RUSSIAN, 0,
- #endif /* CYRILLIC */
- "spanish", L_SPANISH, CM_INV,
- "swedish", L_SWEDISH, 0
- };
- int nlng = (sizeof(lngtab) / sizeof(struct keytab)); /* how many languages */
-
- /* Translation tables ... */
-
- /*
- Note, many more can and should be added, space permitting! Presently we
- have only ASCII and Latin-1 as transfer character sets and ASCII, Latin-1,
- and the Adobe-extended-Macintosh set as file character sets. For each pair
- of (file,transfer) character sets, we need two translation functions, one
- for sending, one for receiving. It is recommended that functions and tables
- for all computers be included in this file, perhaps within #ifdef's, so that
- corrections need be made only in one place.
- */
-
- /* Here is the first table, fully annotated... */
-
- CHAR
- yl1as[] = { /* ISO 8859-1 Latin Alphabet 1 to US ASCII */
- /* Source character Description => Translation */
- /* Dec row/col Set */
- 0, /* 000 00/00 C0 NUL Ctrl-@ => (self) */
- 1, /* 001 00/01 C0 SOH Ctrl-A => (self) */
- 2, /* 002 00/02 C0 STX Ctrl-B => (self) */
- 3, /* 003 00/03 C0 ETX Ctrl-C => (self) */
- 4, /* 004 00/04 C0 EOT Ctrl-D => (self) */
- 5, /* 005 00/05 C0 ENQ Ctrl-E => (self) */
- 6, /* 006 00/06 C0 ACK Ctrl-F => (self) */
- 7, /* 007 00/07 C0 BEL Ctrl-G => (self) */
- 8, /* 008 00/08 C0 BS Ctrl-H => (self) */
- 9, /* 009 00/09 C0 HT Ctrl-I => (self) */
- 10, /* 010 00/10 C0 LF Ctrl-J => (self) */
- 11, /* 011 00/11 C0 VT Ctrl-K => (self) */
- 12, /* 012 00/12 C0 FF Ctrl-L => (self) */
- 13, /* 013 00/13 C0 CR Ctrl-M => (self) */
- 14, /* 014 00/14 C0 SO Ctrl-N => (self) */
- 15, /* 015 00/15 C0 SI Ctrl-O => (self) */
- 16, /* 016 01/00 C0 DLE Ctrl-P => (self) */
- 17, /* 017 01/01 C0 DC1 Ctrl-Q => (self) */
- 18, /* 018 01/02 C0 DC2 Ctrl-R => (self) */
- 19, /* 019 01/03 C0 DC3 Ctrl-S => (self) */
- 20, /* 020 01/04 C0 DC4 Ctrl-T => (self) */
- 21, /* 021 01/05 C0 NAK Ctrl-U => (self) */
- 22, /* 022 01/06 C0 SYN Ctrl-V => (self) */
- 23, /* 023 01/07 C0 ETB Ctrl-W => (self) */
- 24, /* 024 01/08 C0 CAN Ctrl-X => (self) */
- 25, /* 025 01/09 C0 EM Ctrl-Y => (self) */
- 26, /* 026 01/10 C0 SUB Ctrl-Z => (self) */
- 27, /* 027 01/11 C0 ESC Ctrl-[ => (self) */
- 28, /* 028 01/12 C0 FS Ctrl-\ => (self) */
- 29, /* 029 01/13 C0 GS Ctrl-] => (self) */
- 30, /* 030 01/14 C0 RS Ctrl-^ => (self) */
- 31, /* 031 01/15 C0 US Ctrl-_ => (self) */
- 32, /* 032 02/00 SP Space => (self) */
- 33, /* 033 02/01 G0 ! Exclamation mark => (self) */
- 34, /* 034 02/02 G0 " Doublequote => (self) */
- 35, /* 035 02/03 G0 # Number sign => (self) */
- 36, /* 036 02/04 G0 $ Dollar sign => (self) */
- 37, /* 037 02/05 G0 % Percent sign => (self) */
- 38, /* 038 02/06 G0 & Ampersand => (self) */
- 39, /* 039 02/07 G0 ' Apostrophe => (self) */
- 40, /* 040 02/08 G0 ( Left parenthesis => (self) */
- 41, /* 041 02/09 G0 ) Right parenthesis => (self) */
- 42, /* 042 02/10 G0 * Asterisk => (self) */
- 43, /* 043 02/11 G0 + Plus sign => (self) */
- 44, /* 044 02/12 G0 , Comma => (self) */
- 45, /* 045 02/13 G0 - Hyphen, minus sign => (self) */
- 46, /* 046 02/14 G0 . Period, full stop => (self) */
- 47, /* 047 02/15 G0 / Slash, solidus => (self) */
- 48, /* 048 03/00 G0 0 Digit 0 => (self) */
- 49, /* 049 03/01 G0 1 Digit 1 => (self) */
- 50, /* 050 03/02 G0 2 Digit 2 => (self) */
- 51, /* 051 03/03 G0 3 Digit 3 => (self) */
- 52, /* 052 03/04 G0 4 Digit 4 => (self) */
- 53, /* 053 03/05 G0 5 Digit 5 => (self) */
- 54, /* 054 03/06 G0 6 Digit 6 => (self) */
- 55, /* 055 03/07 G0 7 Digit 7 => (self) */
- 56, /* 056 03/08 G0 8 Digit 8 => (self) */
- 57, /* 057 03/09 G0 9 Digit 9 => (self) */
- 58, /* 058 03/10 G0 : Colon => (self) */
- 59, /* 059 03/11 G0 ; Semicolon => (self) */
- 60, /* 060 03/12 G0 < Less-than sign => (self) */
- 61, /* 061 03/13 G0 = Equals sign => (self) */
- 62, /* 062 03/14 G0 > Greater-than sign => (self) */
- 63, /* 063 03/15 G0 ? Question mark => (self) */
- 64, /* 064 04/00 G0 @ Commercial at sign => (self) */
- 65, /* 065 04/01 G0 A Letter A => (self) */
- 66, /* 066 04/02 G0 B Letter B => (self) */
- 67, /* 067 04/03 G0 C Letter C => (self) */
- 68, /* 068 04/04 G0 D Letter D => (self) */
- 69, /* 069 04/05 G0 E Letter E => (self) */
- 70, /* 070 04/06 G0 F Letter F => (self) */
- 71, /* 071 04/07 G0 G Letter G => (self) */
- 72, /* 072 04/08 G0 H Letter H => (self) */
- 73, /* 073 04/09 G0 I Letter I => (self) */
- 74, /* 074 04/10 G0 J Letter J => (self) */
- 75, /* 075 04/11 G0 K Letter K => (self) */
- 76, /* 076 04/12 G0 L Letter L => (self) */
- 77, /* 077 04/13 G0 M Letter M => (self) */
- 78, /* 078 04/14 G0 N Letter N => (self) */
- 79, /* 079 04/15 G0 O Letter O => (self) */
- 80, /* 080 05/00 G0 P Letter P => (self) */
- 81, /* 081 05/01 G0 Q Letter Q => (self) */
- 82, /* 082 05/02 G0 R Letter R => (self) */
- 83, /* 083 05/03 G0 S Letter S => (self) */
- 84, /* 084 05/04 G0 T Letter T => (self) */
- 85, /* 085 05/05 G0 U Letter U => (self) */
- 86, /* 086 05/06 G0 V Letter V => (self) */
- 87, /* 087 05/07 G0 W Letter W => (self) */
- 88, /* 088 05/08 G0 X Letter X => (self) */
- 89, /* 089 05/09 G0 Y Letter Y => (self) */
- 90, /* 090 05/10 G0 Z Letter Z => (self) */
- 91, /* 091 05/11 G0 [ Left square bracket => (self) */
- 92, /* 092 05/12 G0 \ Reverse slash => (self) */
- 93, /* 093 05/13 G0 ] Right square bracket => (self) */
- 94, /* 094 05/14 G0 ^ Circumflex accent => (self) */
- 95, /* 095 05/15 G0 _ Underline, low line => (self) */
- 96, /* 096 06/00 G0 ` Grave accent => (self) */
- 97, /* 097 06/01 G0 a Letter a => (self) */
- 98, /* 098 06/02 G0 b Letter b => (self) */
- 99, /* 099 06/03 G0 c Letter c => (self) */
- 100, /* 100 06/04 G0 d Letter d => (self) */
- 101, /* 101 06/05 G0 e Letter e => (self) */
- 102, /* 102 06/06 G0 f Letter f => (self) */
- 103, /* 103 06/07 G0 g Letter g => (self) */
- 104, /* 104 06/08 G0 h Letter h => (self) */
- 105, /* 105 06/09 G0 i Letter i => (self) */
- 106, /* 106 06/10 G0 j Letter j => (self) */
- 107, /* 107 06/11 G0 k Letter k => (self) */
- 108, /* 108 06/12 G0 l Letter l => (self) */
- 109, /* 109 06/13 G0 m Letter m => (self) */
- 110, /* 110 06/14 G0 n Letter n => (self) */
- 111, /* 111 06/15 G0 o Letter o => (self) */
- 112, /* 112 07/00 G0 p Letter p => (self) */
- 113, /* 113 07/01 G0 q Letter q => (self) */
- 114, /* 114 07/02 G0 r Letter r => (self) */
- 115, /* 115 07/03 G0 s Letter s => (self) */
- 116, /* 116 07/04 G0 t Letter t => (self) */
- 117, /* 117 07/05 G0 u Letter u => (self) */
- 118, /* 118 07/06 G0 v Letter v => (self) */
- 119, /* 119 07/07 G0 w Letter w => (self) */
- 120, /* 120 07/08 G0 x Letter x => (self) */
- 121, /* 121 07/09 G0 y Letter y => (self) */
- 122, /* 122 07/10 G0 z Letter z => (self) */
- 123, /* 123 07/11 G0 { Left curly bracket => (self) */
- 124, /* 124 07/12 G0 | Vertical bar => (self) */
- 125, /* 125 07/13 G0 } Right curly bracket => (self) */
- 126, /* 126 07/14 G0 ~ Tilde => (self) */
- 127, /* 127 07/15 DEL Delete, Rubout => (self) */
- UNK, /* 128 08/00 C1 => UNK */
- UNK, /* 129 08/01 C1 => UNK */
- UNK, /* 130 08/02 C1 => UNK */
- UNK, /* 131 08/03 C1 => UNK */
- UNK, /* 132 08/04 C1 IND => UNK */
- UNK, /* 133 08/05 C1 NEL => UNK */
- UNK, /* 134 08/06 C1 SSA => UNK */
- UNK, /* 135 08/07 C1 ESA => UNK */
- UNK, /* 136 08/08 C1 HTS => UNK */
- UNK, /* 137 08/09 C1 => UNK */
- UNK, /* 138 08/10 C1 => UNK */
- UNK, /* 139 08/11 C1 => UNK */
- UNK, /* 140 08/12 C1 => UNK */
- UNK, /* 141 08/13 C1 RI => UNK */
- UNK, /* 142 08/14 C1 SS2 => UNK */
- UNK, /* 143 08/15 C1 SS3 => UNK */
- UNK, /* 144 09/00 C1 DCS => UNK */
- UNK, /* 145 09/01 C1 => UNK */
- UNK, /* 146 09/02 C1 => UNK */
- UNK, /* 147 09/03 C1 STS => UNK */
- UNK, /* 148 09/04 C1 => UNK */
- UNK, /* 149 09/05 C1 => UNK */
- UNK, /* 150 09/06 C1 SPA => UNK */
- UNK, /* 151 09/07 C1 EPA => UNK */
- UNK, /* 152 09/08 C1 => UNK */
- UNK, /* 153 09/09 C1 => UNK */
- UNK, /* 154 09/10 C1 => UNK */
- UNK, /* 155 09/11 C1 CSI => UNK */
- UNK, /* 156 09/12 C1 ST => UNK */
- UNK, /* 157 09/13 C1 OSC => UNK */
- UNK, /* 158 09/14 C1 PM => UNK */
- UNK, /* 159 09/15 C1 APC => UNK */
- 32, /* 160 10/00 G1 No-break space => SP */
- 33, /* 161 10/01 G1 Inverted exclamation => ! */
- 99, /* 162 10/02 G1 Cent sign => c */
- 35, /* 163 10/03 G1 Pound sign => # */
- 36, /* 164 10/04 G1 Currency sign => $ */
- 89, /* 165 10/05 G1 Yen sign => Y */
- 124, /* 166 10/06 G1 Broken bar => | */
- 80, /* 167 10/07 G1 Paragraph sign => P */
- 34, /* 168 10/08 G1 Diaeresis => " */
- 67, /* 169 10/09 G1 Copyright sign => C */
- 97, /* 170 10/10 G1 Feminine ordinal => a */
- 34, /* 171 10/11 G1 Left angle quotation => " */
- 126, /* 172 10/12 G1 Not sign => ~ */
- 45, /* 173 10/13 G1 Soft hyphen => - */
- 82, /* 174 10/14 G1 Registered trade mark => R */
- 95, /* 175 10/15 G1 Macron => _ */
- 111, /* 176 11/00 G1 Degree sign, ring above => o */
- UNK, /* 177 11/01 G1 Plus-minus sign => UNK */
- 50, /* 178 11/02 G1 Superscript two => 2 */
- 51, /* 179 11/03 G1 Superscript three => 3 */
- 39, /* 180 11/04 G1 Acute accent => ' */
- 117, /* 181 11/05 G1 Micro sign => u */
- 45, /* 182 11/06 G1 Pilcrow sign => - */
- 45, /* 183 11/07 G1 Middle dot => - */
- 44, /* 184 11/08 G1 Cedilla => , */
- 49, /* 185 11/09 G1 Superscript one => 1 */
- 111, /* 186 11/10 G1 Masculine ordinal => o */
- 34, /* 187 11/11 G1 Right angle quotation => " */
- UNK, /* 188 11/12 G1 One quarter => UNK */
- UNK, /* 189 11/13 G1 One half => UNK */
- UNK, /* 190 11/14 G1 Three quarters => UNK */
- 63, /* 191 11/15 G1 Inverted question mark => ? */
- 65, /* 192 12/00 G1 A grave => A */
- 65, /* 193 12/01 G1 A acute => A */
- 65, /* 194 12/02 G1 A circumflex => A */
- 65, /* 195 12/03 G1 A tilde => A */
- 65, /* 196 12/04 G1 A diaeresis => A */
- 65, /* 197 12/05 G1 A ring above => A */
- 65, /* 198 12/06 G1 A with E => A */
- 67, /* 199 12/07 G1 C Cedilla => C */
- 69, /* 200 12/08 G1 E grave => E */
- 69, /* 201 12/09 G1 E acute => E */
- 69, /* 202 12/10 G1 E circumflex => E */
- 69, /* 203 12/11 G1 E diaeresis => E */
- 73, /* 204 12/12 G1 I grave => I */
- 73, /* 205 12/13 G1 I acute => I */
- 73, /* 206 12/14 G1 I circumflex => I */
- 73, /* 207 12/15 G1 I diaeresis => I */
- 68, /* 208 13/00 G1 Icelandic Eth => D */
- 78, /* 209 13/01 G1 N tilde => N */
- 79, /* 210 13/02 G1 O grave => O */
- 79, /* 211 13/03 G1 O acute => O */
- 79, /* 212 13/04 G1 O circumflex => O */
- 79, /* 213 13/05 G1 O tilde => O */
- 79, /* 214 13/06 G1 O diaeresis => O */
- 120, /* 215 13/07 G1 Multiplication sign => x */
- 79, /* 216 13/08 G1 O oblique stroke => O */
- 85, /* 217 13/09 G1 U grave => U */
- 85, /* 218 13/10 G1 U acute => U */
- 85, /* 219 13/11 G1 U circumflex => U */
- 85, /* 220 13/12 G1 U diaeresis => U */
- 89, /* 221 13/13 G1 Y acute => Y */
- 84, /* 222 13/14 G1 Icelandic Thorn => T */
- 115, /* 223 13/15 G1 German sharp s => s */
- 97, /* 224 14/00 G1 a grave => a */
- 97, /* 225 14/01 G1 a acute => a */
- 97, /* 226 14/02 G1 a circumflex => a */
- 97, /* 227 14/03 G1 a tilde => a */
- 97, /* 228 14/04 G1 a diaeresis => a */
- 97, /* 229 14/05 G1 a ring above => a */
- 97, /* 230 14/06 G1 a with e => a */
- 99, /* 231 14/07 G1 c cedilla => c */
- 101, /* 232 14/08 G1 e grave => e */
- 101, /* 233 14/09 G1 e acute => e */
- 101, /* 234 14/10 G1 e circumflex => e */
- 101, /* 235 14/11 G1 e diaeresis => e */
- 105, /* 236 14/12 G1 i grave => i */
- 105, /* 237 14/13 G1 i acute => i */
- 105, /* 238 14/14 G1 i circumflex => i */
- 105, /* 239 14/15 G1 i diaeresis => i */
- 100, /* 240 15/00 G1 Icelandic eth => d */
- 110, /* 241 15/01 G1 n tilde => n */
- 111, /* 242 15/02 G1 o grave => o */
- 111, /* 243 15/03 G1 o acute => o */
- 111, /* 244 15/04 G1 o circumflex => o */
- 111, /* 245 15/05 G1 o tilde => o */
- 111, /* 246 15/06 G1 o diaeresis => o */
- 47, /* 247 15/07 G1 Division sign => / */
- 111, /* 248 15/08 G1 o oblique stroke => o */
- 117, /* 249 15/09 G1 u grave => u */
- 117, /* 250 15/10 G1 u acute => u */
- 117, /* 251 15/11 G1 u circumflex => u */
- 117, /* 252 15/12 G1 u diaeresis => u */
- 121, /* 253 15/13 G1 y acute => y */
- 116, /* 254 15/14 G1 Icelandic thorn => t */
- 121 /* 255 15/15 G1 y diaeresis => y */
- }
- ;
-
- /* Translation tables for ISO Latin Alphabet 1 to local file character sets */
-
- CHAR
- yl1aq[] = { /* Latin-1 to Extended Mac Latin (based on Apple QuickDraw) */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 182, 183, 184, 185, 189, 196, 197, 198, 206, 207, 210, 211, 217, 218, 195, 212,
- 209, 215, 213, 226, 227, 228, 240, 245, 246, 247, 249, 250, 251, 253, 254, 255,
- 202, 193, 162, 163, 219, 180, 201, 164, 172, 169, 187, 199, 194, 208, 168, 248,
- 161, 177, 170, 173, 171, 181, 166, 225, 252, 176, 188, 200, 178, 179, 186, 192,
- 203, 231, 229, 204, 128, 129, 174, 130, 233, 131, 230, 232, 237, 234, 235, 236,
- 220, 132, 241, 238, 239, 205, 133, 165, 175, 244, 242, 243, 134, 160, 222, 167,
- 136, 135, 137, 139, 138, 140, 190, 141, 143, 142, 144, 145, 147, 146, 148, 149,
- 221, 150, 152, 151, 153, 155, 154, 214, 191, 157, 156, 158, 159, 224, 223, 216
- };
-
- /* Local file character sets to ISO Latin Alphabet 1 */
-
- #ifdef COMMENT
- CHAR
- yasl1[] = { /* ASCII to Latin-1 */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127
- };
- #endif /* COMMENT */
-
- CHAR
- yaql1[] = { /* Extended Mac Latin (based on Apple Quickdraw) to Latin-1 */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
- 196, 197, 199, 201, 209, 214, 220, 225, 224, 226, 228, 227, 229, 231, 233, 232,
- 234, 235, 237, 236, 238, 239, 241, 243, 242, 244, 246, 245, 250, 249, 251, 252,
- 221, 176, 162, 163, 167, 215, 182, 223, 174, 169, 178, 180, 168, 179, 198, 216,
- 185, 177, 188, 189, 165, 181, 128, 129, 130, 131, 190, 170, 186, 132, 230, 248,
- 191, 161, 172, 142, 133, 134, 135, 171, 187, 166, 160, 192, 195, 213, 136, 137,
- 173, 144, 138, 139, 143, 146, 247, 145, 255, 140, 141, 164, 208, 240, 222, 254,
- 253, 183, 147, 148, 149, 194, 202, 193, 203, 200, 205, 206, 207, 204, 211, 212,
- 150, 210, 218, 219, 217, 151, 152, 153, 175, 154, 155, 156, 184, 157, 158, 159
- };
-
- /* Translation functions ... */
-
- #ifdef COMMENT
- /*
- Not needed...
- */
- CHAR /* The identity translation function */
- ident(c) CHAR c; {
- return(c);
- }
- #endif /* COMMENT */
-
- /* Latin-1 to US ASCII... */
- CHAR
- #ifdef CK_ANSIC
- xl1as(CHAR c)
- #else
- xl1as(c) CHAR c;
- #endif /* CK_ANSIC */
- { /* xl1as */
- switch(langs[language].id) {
-
- case L_DUTCH:
- if (c == 255) { /* Dutch umlaut-y */
- zmstuff('j'); /* becomes ij */
- return('i');
- } else return(yl1as[c]); /* all others by the book */
-
- case L_GERMAN:
- switch (c) { /* German, special rules. */
- case 196: /* umlaut-A -> Ae */
- zmstuff('e');
- return('A');
- case 214: /* umlaut-O -> Oe */
- zmstuff('e');
- return('O');
- case 220: /* umlaut-U -> Ue */
- zmstuff('e');
- return('U');
- case 228: /* umlaut-a -> ae */
- zmstuff('e');
- return('a');
- case 246: /* umlaut-o -> oe */
- zmstuff('e');
- return('o');
- case 252: /* umlaut-u -> ue */
- zmstuff('e');
- return('u');
- case 223: /* ess-zet -> ss */
- zmstuff('s');
- return('s');
- default: return(yl1as[c]); /* all others by the book */
- }
- case L_DANISH:
- case L_FINNISH:
- case L_NORWEGIAN:
- case L_SWEDISH:
- switch (c) { /* Scandanavian languages. */
- case 196: /* umlaut-A -> Ae */
- case 198: /* AE ligature also -> Ae */
- zmstuff('e');
- return('A');
- case 214: /* umlaut-O -> Oe */
- case 216: /* O-slash -> Oe */
- zmstuff('e');
- return('O');
- case 220: /* umlaut-U -> Ue */
- /* return('Y'); replaced by "Ue" by popular demand. */
- /* Y for Umlaut-U is only used in German names. */
- zmstuff('e');
- return('U');
- case 228: /* umlaut-a -> ae */
- case 230: /* ditto for ae ligature */
- zmstuff('e');
- return('a');
- case 246: /* umlaut-o -> oe */
- case 248: /* o-slash -> oe */
- zmstuff('e');
- return('o');
- case 252: /* umlaut-u -> ue */
- /* return('y'); replaced by "ue" by popular demand. */
- zmstuff('e');
- return('u');
- case 197: /* A-ring -> Aa */
- zmstuff('a');
- return('A');
- case 229: /* a-ring -> aa */
- zmstuff('a');
- return('a');
- default: return(yl1as[c]); /* All others by the book */
- }
- case L_ICELANDIC: /* Icelandic. */
- switch (c) {
- case 198: /* uppercase AE -> AE */
- zmstuff('e');
- return('A');
- case 208: /* uppercase Eth -> D */
- return('D');
- case 222: /* uppercase Thorn -> Th */
- zmstuff('h');
- return('T');
- case 230: /* lowercase ae -> ae */
- zmstuff('e');
- return('a');
- case 240: /* lowercase Eth -> d */
- return('d');
- case 254: /* lowercase Thorn -> th */
- zmstuff('h');
- return('t');
- default: return(yl1as[c]); /* All others by the book */
- }
- default:
- return(yl1as[c]); /* None of the above, by the table. */
- }
- }
-
- /* Translation functions for receiving files and translating them into ASCII */
-
- CHAR
- zl1as(c) CHAR c; {
- switch(langs[language].id) {
-
- case L_DUTCH:
- if (c == 255) { /* Dutch umlaut-y */
- zdstuff('j'); /* becomes ij */
- return('i');
- } else return(yl1as[c]); /* all others by the book */
-
- case L_GERMAN:
- switch (c) { /* German, special rules. */
- case 196: /* umlaut-A -> Ae */
- zdstuff('e');
- return('A');
- case 214: /* umlaut-O -> Oe */
- zdstuff('e');
- return('O');
- case 220: /* umlaut-U -> Ue */
- zdstuff('e');
- return('U');
- case 228: /* umlaut-a -> ae */
- zdstuff('e');
- return('a');
- case 246: /* umlaut-o -> oe */
- zdstuff('e');
- return('o');
- case 252: /* umlaut-u -> ue */
- zdstuff('e');
- return('u');
- case 223: /* ess-zet -> ss */
- zdstuff('s');
- return('s');
- default: return(yl1as[c]); /* all others by the book */
- }
- case L_DANISH:
- case L_FINNISH:
- case L_NORWEGIAN:
- case L_SWEDISH:
- switch (c) { /* Scandanavian languages. */
- case 196: /* umlaut-A -> Ae */
- zdstuff('e');
- return('A');
- case 214: /* umlaut-O -> Oe */
- case 216: /* O-slash -> Oe */
- zdstuff('e');
- return('O');
- case 220: /* umlaut-U -> Y */
- /* return('Y'); */
- zdstuff('e');
- return('U');
- case 228: /* umlaut-a -> ae */
- zdstuff('e');
- return('a');
- case 246: /* umlaut-o -> oe */
- case 248: /* o-slash -> oe */
- zdstuff('e');
- return('o');
- case 252: /* umlaut-u -> y */
- /* return('y'); */
- zdstuff('e');
- return('u');
- case 197: /* A-ring -> Aa */
- zdstuff('a');
- return('A');
- case 229: /* a-ring -> aa */
- zdstuff('a');
- return('a');
- default: return(yl1as[c]); /* All others by the book */
- }
- default:
- return(yl1as[c]); /* Not German, by the table. */
- }
- }
-
- /* Apple Mac to ASCII */
- CHAR
- #ifdef CK_ANSIC
- xaqas(CHAR c)
- #else
- xaqas(c) CHAR c;
- #endif /* CK_ANSIC */
- { /* xaqas */
- c = yaql1[c]; /* Translate to Latin-1 */
- return(xl1as(c)); /* then to ASCII. */
- }
-
- CHAR
- #ifdef CK_ANSIC
- xl1aq(CHAR c)
- #else
- xl1aq(c) CHAR c;
- #endif /* CK_ANSIC */
- { /* xl1aq */ /* Latin-1 to Apple Macintosh Character Set */
- return(yl1aq[c]);
- }
-
- /* Apple Macintosh Character Set to Latin-1 */
- CHAR
- #ifdef CK_ANSIC
- xaql1(CHAR c)
- #else
- xaql1(c) CHAR c;
- #endif /* CK_ANSIC */
- { /* xaql1 */
- return(yaql1[c]);
- }
-
- /*
- Table of translation functions for receiving files.
- Array of pointers to functions for translating from the transfer
- syntax to the local file character set. The first index is the
- transfer syntax character set number, the second index is the file
- character set number.
- */
- #ifdef CK_ANSIC
- CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
- #else
- CHAR (*xlr[MAXTCSETS+1][MAXFCSETS+1])() =
- #endif /* CK_ANSIC */
- {
- NULL, /* 0,0 transparent to us ascii */
- NULL, /* 0,1 transparent to latin-1 */
- NULL, /* 0,2 transparent to Apple Quickdraw */
- NULL, /* 1,0 ascii to us ascii */
- NULL, /* 1,2 ascii to latin-1 */
- NULL, /* 1,3 ascii to Apple Quickdraw */
- zl1as, /* 2,0 latin-1 to us ascii */
- NULL, /* 2,1 latin-1 to latin-1 */
- xl1aq /* 2,2 latin-1 to Apple Quickdraw */
- };
-
- /*
- Translation functions for sending files.
- Array of pointers to functions for translating from the local file
- character set to the transfer syntax character set. Indexed in the same
- way as the xlr array above.
- */
- #ifdef CK_ANSIC
- CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])(CHAR) =
- #else
- CHAR (*xls[MAXTCSETS+1][MAXFCSETS+1])() =
- #endif /* CK_ANSIC */
- {
-
- NULL, /* 0,0 us ascii to transparent */
- NULL, /* 0,1 latin-1 to transparent */
- NULL, /* 0,2 Apple Quickdraw to transparent */
- NULL, /* 1,0 ascii to ascii */
- xl1as, /* 1,2 latin-1 to ascii */
- xaqas, /* 1,3 Apple Quickdraw to ascii */
- NULL, /* 2,0 ascii to latin-1 */
- NULL, /* 2,1 latin-1 to latin-1 */
- xaql1 /* 2,2 Apple Quickdraw to latin-1 */
- };
-